package com.masterclient.app.businessmodule.minemodule.cash.adapter;

import android.text.TextUtils;
import android.view.View;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.eoner.baselibrary.utils.StringsUtils;
import com.masterclient.app.R;
import com.masterclient.app.businessmodule.minemodule.cash.bean.BalanceOrderBean;
import com.eoner.baselibrary.utils.Utils;

/**
 * 作者：sean
 * 创建时间：2017/10/13 17:00
 * 功能说明：
 */

public class BalanceOrderAdapter extends BaseQuickAdapter<BalanceOrderBean.DataBean.ShItemsBean,BaseViewHolder>{
    public BalanceOrderAdapter() {
        super(R.layout.item_view_cash_get);
    }

    @Override
    protected void convert(BaseViewHolder helper, BalanceOrderBean.DataBean.ShItemsBean item) {
        helper.setText(R.id.tv_type,item.getSh_type_reason());
        if(!TextUtils.isEmpty(item.getSh_detail_no())){
            helper.setText(R.id.tv_num,item.getSh_detail_no());
        }else {
            helper.getView(R.id.tv_num).setVisibility(View.GONE);
        }
        helper.setText(R.id.tv_time,item.getSh_create_at());
        helper.setText(R.id.tv_money,"-"+ StringsUtils.keep2num(item.getSh_amount()));
        Utils.setDin(helper.getView(R.id.tv_money),mContext);
        if(helper.getLayoutPosition() == getData().size()-1){
            helper.getView(R.id.v_line).setVisibility(View.INVISIBLE);
        }
    }

}
